<html>
<head>
<title>Help : Academic Advisor</title>
<!--script src="lib/jquery/jquery-1.3.2.js"--><!--/script-->
<!--script src="http://code.google.com/apis/gears/gears_init.js"--><!--/script-->
<!--script src="js/mainPage.js"--> <!--/script-->

<style type="text/css">
a:link {color:#FFFFFF;}    /* unvisited link */
.class1 a:link{color:#000000} /*for appointments*/
a:visited {color:#FF0000;} /* visited link */
a:hover {color:#FFFF00;}   /* mouse over link */
a:active {color:#FF8040;}  /* selected link */
</style>

</head>
<!--------------------------------------------------------Design part of the code---------------------------------------------->
<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginheight="0" marginwidth="0" bgcolor="#000066">

<table border="0" width="100%" cellspacing="0" cellpadding="0" bgcolor="#000066">
  <tr>
  <td><img src="../images/jsu_banner.jpg"></td>
  </tr>
</table>

<table border="0" width="100%" bgcolor="#000000" cellspacing="0" cellpadding="0">
  <tr>
  <center><td width="100%"><font color="#FFFFFF" face="Arial" size="2"><b>D.O.R.S. Jackson State University Edition</b></font></td></center>
     <?php
	session_start();
	$JNo = $_SESSION['JNo'];
	echo "<center><td width='100%'><font color='#FFFFFF' face='Arial' size='2'><b>JSU ID: $JNo</b></font></td></center>";
  ?>
  </tr>
</table>

<table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr>
    <td width="18%" bgcolor="#000066" valign="top">&nbsp;


<!------------------------------------------End of Design-------------------------------------------------------->


<center>
<img src="../images/logo.jpg">
</center>

<center>
<img src="../images/courses_sign.jpg">
</center>

<center>
<table>
<tr>
<td><b><a href="http://localhost/OnlineSystem/WebContent/financialAidPage.php">Financial Aid</b></a></td>
<td><b><a href="http://localhost/OnlineSystem/WebContent/accountSummaryPage.php">Account Summary</b></a></td>
<td><b><a href="http://localhost/OnlineSystem/WebContent/purchaseBookPage.php">Purchase Your Books</b></a></td>
<td><b><a href="http://localhost/OnlineSystem/WebContent/selectCourses.php">Choose Courses</b></a></td>
</tr>
</table>
</center>


<center>
<!-- Course Page -->
<table border="3" width="25%" cellspacing="0" cellpadding="0" bgcolor="#F0F8FF">
<tr>
<td><b>Counselor</b></td>
<td><b>Status</b></td>
</tr>


<tr>
	<td>
		<!-- Something about Selecting an advisor -->
	</td>
	<?php
		function get_column_names_with_show ($tbl_name){
		$query = "SHOW COLUMNS FROM $tbl_name";
		if (!($result_id = mysql_query ($query)))
			return (FALSE);
		$names = array( );               # create empty array
		# first value in each output row is the column name
		while (list ($name) = mysql_fetch_row ($result_id))
			$names[ ] = $name;           # append name to array
		mysql_free_result ($result_id);
		return ($names);
		}
		$host="localhost"; // Host name
		$username="root"; // Mysql username
		$password=""; // Mysql password
		$db_name="JSU_Database"; // Database name

		// Connect to server and select database.
		mysql_connect($host, $username, $password)or die("cannot connect");
		mysql_select_db($db_name)or die("cannot select DB: ".mysql_error());

		$day = $_POST['day'];
		$time = $_POST['time'];
		$totalTime = $day." ".$time;
		echo "<font color='#ffffff'>$totalTime</font>";
		$result = mysql_query("SELECT Fname, Mname, Lname, JNo FROM finan_timetable, financial_advisor WHERE `".$totalTime."` = 'Available' AND AdvisorJNo = JNo ORDER BY Lname");
		if (!$result)
			die("<font color='#ffffff'><br>All counselors for this time period are occupied. Try another time.</font>");
		echo "<form name = 'appointmentList' id='appointmentList' method='post'>";
		while ($row = mysql_fetch_row($result)){
			echo "<tr><td>$row[2], $row[0] $row[1]</td>";
			$ajNo2 = $row[3];
			echo "<td><span class='class1'><a href='setAppointment.php?time=$totalTime&ajNo=$ajNo2'>Set Appointment</a></span></td>";
			echo "</tr>";
		}
	?>
</table>
</center>

<center>
<INPUT type="button" value="Back" name="button1" onClick="history.go(-1); return true;"> 
<INPUT type="submit" value="Next" name="button2">
</FORM>
</center>

</body>
</html>